<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // function People(name,age){
        //     this.name = name;
        //     this.age = age;
        //     this.intro = function(){
        //         console.log(`我是${this.name}，今年${this.age}岁`);
        //     }
        // }
        class People{
            addr = ["红瓦寺","新华公园"];
            constructor(name,age,gender){
                this.name = name;
                this.age = age;
                this._gender = gender;
            }
            get gender(){
                return this._gender;
            }
            set gender(_gender){
                this._gender = _gender;
            }
            intro(){
                console.log(`我是${this.name}，今年${this.age}岁，性别为${this._gender}`);
            }
        }
        let p = new People("张三",20,"男");
        p.intro();
        p.gender = "女";

        class ChinesePeople extends People{
            sayArea(){
                console.log("我来自中国");
            }
        }
        let p1 = new ChinesePeople("李四",30,"男");
        p1.gender = "女";
        p1.intro(); 

        class JapanesePeople extends People{
            sayArea(){
                console.log("我来自日本");
            }
        }
        function say(people){
            people.sayArea();
        }
        say(new ChinesePeople())
        say(new JapanesePeople())
        console.log(ChinesePeople.prototype.__proto__);
        let {name:myName,age,addr} = p1;
        let [a,b,c] = [1,2,3]
        console.log(myName,age,addr);
        console.log(a,b,c);

        let p2 = new People();
        for(let k in p){
            p2[k] = p[k];
        }
        console.log(p.addr == p2.addr);
        
       let p3 = JSON.parse(JSON.stringify(p));
       let p4 = {...p}
       console.log(p4,p4.addr == p.addr);
    </script>
</body>
</html>